// **********************************************************************
//
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

// Ice version 3.3.1
// Generated from file `Camera.ice'

#include <Camera.h>
#include <Ice/LocalException.h>
#include <Ice/ObjectFactory.h>
#include <Ice/BasicStream.h>
#include <IceUtil/Iterator.h>
#include <IceUtil/ScopedArray.h>

#ifndef ICE_IGNORE_VERSION
#   if ICE_INT_VERSION / 100 != 303
#       error Ice version mismatch!
#   endif
#   if ICE_INT_VERSION % 100 > 50
#       error Beta header file detected
#   endif
#   if ICE_INT_VERSION % 100 < 1
#       error Ice patch level mismatch!
#   endif
#endif

static const ::std::string __RoboCompCamera__Camera__getYUVImage_name = "getYUVImage";

static const ::std::string __RoboCompCamera__Camera__getYImage_name = "getYImage";

static const ::std::string __RoboCompCamera__Camera__getYLogPolarImage_name = "getYLogPolarImage";

static const ::std::string __RoboCompCamera__Camera__getYImageCR_name = "getYImageCR";

static const ::std::string __RoboCompCamera__Camera__getRGBPackedImage_name = "getRGBPackedImage";

static const ::std::string __RoboCompCamera__Camera__getYRGBImage_name = "getYRGBImage";

static const ::std::string __RoboCompCamera__Camera__getCamParams_name = "getCamParams";

static const ::std::string __RoboCompCamera__Camera__setInnerImage_name = "setInnerImage";

::Ice::Object* IceInternal::upCast(::RoboCompCamera::Camera* p) { return p; }
::IceProxy::Ice::Object* IceInternal::upCast(::IceProxy::RoboCompCamera::Camera* p) { return p; }

void
RoboCompCamera::__read(::IceInternal::BasicStream* __is, ::RoboCompCamera::CameraPrx& v)
{
    ::Ice::ObjectPrx proxy;
    __is->read(proxy);
    if(!proxy)
    {
        v = 0;
    }
    else
    {
        v = new ::IceProxy::RoboCompCamera::Camera;
        v->__copyFrom(proxy);
    }
}

RoboCompCamera::HardwareFailedException::HardwareFailedException(const ::std::string& __ice_what) :
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    UserException(),
#else
    ::Ice::UserException(),
#endif
    what(__ice_what)
{
}

RoboCompCamera::HardwareFailedException::~HardwareFailedException() throw()
{
}

static const char* __RoboCompCamera__HardwareFailedException_name = "RoboCompCamera::HardwareFailedException";

::std::string
RoboCompCamera::HardwareFailedException::ice_name() const
{
    return __RoboCompCamera__HardwareFailedException_name;
}

::Ice::Exception*
RoboCompCamera::HardwareFailedException::ice_clone() const
{
    return new HardwareFailedException(*this);
}

void
RoboCompCamera::HardwareFailedException::ice_throw() const
{
    throw *this;
}

void
RoboCompCamera::HardwareFailedException::__write(::IceInternal::BasicStream* __os) const
{
    __os->write(::std::string("::RoboCompCamera::HardwareFailedException"), false);
    __os->startWriteSlice();
    __os->write(what);
    __os->endWriteSlice();
}

void
RoboCompCamera::HardwareFailedException::__read(::IceInternal::BasicStream* __is, bool __rid)
{
    if(__rid)
    {
        ::std::string myId;
        __is->read(myId, false);
    }
    __is->startReadSlice();
    __is->read(what);
    __is->endReadSlice();
}

void
RoboCompCamera::HardwareFailedException::__write(const ::Ice::OutputStreamPtr&) const
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "exception RoboCompCamera::HardwareFailedException was not generated with stream support";
    throw ex;
}

void
RoboCompCamera::HardwareFailedException::__read(const ::Ice::InputStreamPtr&, bool)
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "exception RoboCompCamera::HardwareFailedException was not generated with stream support";
    throw ex;
}

struct __F__RoboCompCamera__HardwareFailedException : public ::IceInternal::UserExceptionFactory
{
    virtual void
    createAndThrow()
    {
        throw ::RoboCompCamera::HardwareFailedException();
    }
};

static ::IceInternal::UserExceptionFactoryPtr __F__RoboCompCamera__HardwareFailedException__Ptr = new __F__RoboCompCamera__HardwareFailedException;

const ::IceInternal::UserExceptionFactoryPtr&
RoboCompCamera::HardwareFailedException::ice_factory()
{
    return __F__RoboCompCamera__HardwareFailedException__Ptr;
}

class __F__RoboCompCamera__HardwareFailedException__Init
{
public:

    __F__RoboCompCamera__HardwareFailedException__Init()
    {
        ::IceInternal::factoryTable->addExceptionFactory("::RoboCompCamera::HardwareFailedException", ::RoboCompCamera::HardwareFailedException::ice_factory());
    }

    ~__F__RoboCompCamera__HardwareFailedException__Init()
    {
        ::IceInternal::factoryTable->removeExceptionFactory("::RoboCompCamera::HardwareFailedException");
    }
};

static __F__RoboCompCamera__HardwareFailedException__Init __F__RoboCompCamera__HardwareFailedException__i;

#ifdef __APPLE__
extern "C" { void __F__RoboCompCamera__HardwareFailedException__initializer() {} }
#endif

RoboCompCamera::MovingImageException::MovingImageException(const ::std::string& __ice_what) :
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    UserException(),
#else
    ::Ice::UserException(),
#endif
    what(__ice_what)
{
}

RoboCompCamera::MovingImageException::~MovingImageException() throw()
{
}

static const char* __RoboCompCamera__MovingImageException_name = "RoboCompCamera::MovingImageException";

::std::string
RoboCompCamera::MovingImageException::ice_name() const
{
    return __RoboCompCamera__MovingImageException_name;
}

::Ice::Exception*
RoboCompCamera::MovingImageException::ice_clone() const
{
    return new MovingImageException(*this);
}

void
RoboCompCamera::MovingImageException::ice_throw() const
{
    throw *this;
}

void
RoboCompCamera::MovingImageException::__write(::IceInternal::BasicStream* __os) const
{
    __os->write(::std::string("::RoboCompCamera::MovingImageException"), false);
    __os->startWriteSlice();
    __os->write(what);
    __os->endWriteSlice();
}

void
RoboCompCamera::MovingImageException::__read(::IceInternal::BasicStream* __is, bool __rid)
{
    if(__rid)
    {
        ::std::string myId;
        __is->read(myId, false);
    }
    __is->startReadSlice();
    __is->read(what);
    __is->endReadSlice();
}

void
RoboCompCamera::MovingImageException::__write(const ::Ice::OutputStreamPtr&) const
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "exception RoboCompCamera::MovingImageException was not generated with stream support";
    throw ex;
}

void
RoboCompCamera::MovingImageException::__read(const ::Ice::InputStreamPtr&, bool)
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "exception RoboCompCamera::MovingImageException was not generated with stream support";
    throw ex;
}

struct __F__RoboCompCamera__MovingImageException : public ::IceInternal::UserExceptionFactory
{
    virtual void
    createAndThrow()
    {
        throw ::RoboCompCamera::MovingImageException();
    }
};

static ::IceInternal::UserExceptionFactoryPtr __F__RoboCompCamera__MovingImageException__Ptr = new __F__RoboCompCamera__MovingImageException;

const ::IceInternal::UserExceptionFactoryPtr&
RoboCompCamera::MovingImageException::ice_factory()
{
    return __F__RoboCompCamera__MovingImageException__Ptr;
}

class __F__RoboCompCamera__MovingImageException__Init
{
public:

    __F__RoboCompCamera__MovingImageException__Init()
    {
        ::IceInternal::factoryTable->addExceptionFactory("::RoboCompCamera::MovingImageException", ::RoboCompCamera::MovingImageException::ice_factory());
    }

    ~__F__RoboCompCamera__MovingImageException__Init()
    {
        ::IceInternal::factoryTable->removeExceptionFactory("::RoboCompCamera::MovingImageException");
    }
};

static __F__RoboCompCamera__MovingImageException__Init __F__RoboCompCamera__MovingImageException__i;

#ifdef __APPLE__
extern "C" { void __F__RoboCompCamera__MovingImageException__initializer() {} }
#endif

bool
RoboCompCamera::TCamParams::operator==(const TCamParams& __rhs) const
{
    if(this == &__rhs)
    {
        return true;
    }
    if(name != __rhs.name)
    {
        return false;
    }
    if(driver != __rhs.driver)
    {
        return false;
    }
    if(device != __rhs.device)
    {
        return false;
    }
    if(mode != __rhs.mode)
    {
        return false;
    }
    if(focal != __rhs.focal)
    {
        return false;
    }
    if(width != __rhs.width)
    {
        return false;
    }
    if(height != __rhs.height)
    {
        return false;
    }
    if(size != __rhs.size)
    {
        return false;
    }
    if(numCams != __rhs.numCams)
    {
        return false;
    }
    if(FPS != __rhs.FPS)
    {
        return false;
    }
    if(timerPeriod != __rhs.timerPeriod)
    {
        return false;
    }
    if(leftCamera != __rhs.leftCamera)
    {
        return false;
    }
    if(rightCamera != __rhs.rightCamera)
    {
        return false;
    }
    if(bothCameras != __rhs.bothCameras)
    {
        return false;
    }
    if(inverted != __rhs.inverted)
    {
        return false;
    }
    if(rotated != __rhs.rotated)
    {
        return false;
    }
    if(leftInverted != __rhs.leftInverted)
    {
        return false;
    }
    if(rightInverted != __rhs.rightInverted)
    {
        return false;
    }
    if(saturation != __rhs.saturation)
    {
        return false;
    }
    if(lineFreq != __rhs.lineFreq)
    {
        return false;
    }
    if(talkToBase != __rhs.talkToBase)
    {
        return false;
    }
    if(talkToCommonHead != __rhs.talkToCommonHead)
    {
        return false;
    }
    return true;
}

bool
RoboCompCamera::TCamParams::operator<(const TCamParams& __rhs) const
{
    if(this == &__rhs)
    {
        return false;
    }
    if(name < __rhs.name)
    {
        return true;
    }
    else if(__rhs.name < name)
    {
        return false;
    }
    if(driver < __rhs.driver)
    {
        return true;
    }
    else if(__rhs.driver < driver)
    {
        return false;
    }
    if(device < __rhs.device)
    {
        return true;
    }
    else if(__rhs.device < device)
    {
        return false;
    }
    if(mode < __rhs.mode)
    {
        return true;
    }
    else if(__rhs.mode < mode)
    {
        return false;
    }
    if(focal < __rhs.focal)
    {
        return true;
    }
    else if(__rhs.focal < focal)
    {
        return false;
    }
    if(width < __rhs.width)
    {
        return true;
    }
    else if(__rhs.width < width)
    {
        return false;
    }
    if(height < __rhs.height)
    {
        return true;
    }
    else if(__rhs.height < height)
    {
        return false;
    }
    if(size < __rhs.size)
    {
        return true;
    }
    else if(__rhs.size < size)
    {
        return false;
    }
    if(numCams < __rhs.numCams)
    {
        return true;
    }
    else if(__rhs.numCams < numCams)
    {
        return false;
    }
    if(FPS < __rhs.FPS)
    {
        return true;
    }
    else if(__rhs.FPS < FPS)
    {
        return false;
    }
    if(timerPeriod < __rhs.timerPeriod)
    {
        return true;
    }
    else if(__rhs.timerPeriod < timerPeriod)
    {
        return false;
    }
    if(leftCamera < __rhs.leftCamera)
    {
        return true;
    }
    else if(__rhs.leftCamera < leftCamera)
    {
        return false;
    }
    if(rightCamera < __rhs.rightCamera)
    {
        return true;
    }
    else if(__rhs.rightCamera < rightCamera)
    {
        return false;
    }
    if(bothCameras < __rhs.bothCameras)
    {
        return true;
    }
    else if(__rhs.bothCameras < bothCameras)
    {
        return false;
    }
    if(inverted < __rhs.inverted)
    {
        return true;
    }
    else if(__rhs.inverted < inverted)
    {
        return false;
    }
    if(rotated < __rhs.rotated)
    {
        return true;
    }
    else if(__rhs.rotated < rotated)
    {
        return false;
    }
    if(leftInverted < __rhs.leftInverted)
    {
        return true;
    }
    else if(__rhs.leftInverted < leftInverted)
    {
        return false;
    }
    if(rightInverted < __rhs.rightInverted)
    {
        return true;
    }
    else if(__rhs.rightInverted < rightInverted)
    {
        return false;
    }
    if(saturation < __rhs.saturation)
    {
        return true;
    }
    else if(__rhs.saturation < saturation)
    {
        return false;
    }
    if(lineFreq < __rhs.lineFreq)
    {
        return true;
    }
    else if(__rhs.lineFreq < lineFreq)
    {
        return false;
    }
    if(talkToBase < __rhs.talkToBase)
    {
        return true;
    }
    else if(__rhs.talkToBase < talkToBase)
    {
        return false;
    }
    if(talkToCommonHead < __rhs.talkToCommonHead)
    {
        return true;
    }
    else if(__rhs.talkToCommonHead < talkToCommonHead)
    {
        return false;
    }
    return false;
}

void
RoboCompCamera::TCamParams::__write(::IceInternal::BasicStream* __os) const
{
    __os->write(name);
    __os->write(driver);
    __os->write(device);
    __os->write(mode);
    __os->write(focal);
    __os->write(width);
    __os->write(height);
    __os->write(size);
    __os->write(numCams);
    __os->write(FPS);
    __os->write(timerPeriod);
    __os->write(leftCamera);
    __os->write(rightCamera);
    __os->write(bothCameras);
    __os->write(inverted);
    __os->write(rotated);
    __os->write(leftInverted);
    __os->write(rightInverted);
    __os->write(saturation);
    __os->write(lineFreq);
    __os->write(talkToBase);
    __os->write(talkToCommonHead);
}

void
RoboCompCamera::TCamParams::__read(::IceInternal::BasicStream* __is)
{
    __is->read(name);
    __is->read(driver);
    __is->read(device);
    __is->read(mode);
    __is->read(focal);
    __is->read(width);
    __is->read(height);
    __is->read(size);
    __is->read(numCams);
    __is->read(FPS);
    __is->read(timerPeriod);
    __is->read(leftCamera);
    __is->read(rightCamera);
    __is->read(bothCameras);
    __is->read(inverted);
    __is->read(rotated);
    __is->read(leftInverted);
    __is->read(rightInverted);
    __is->read(saturation);
    __is->read(lineFreq);
    __is->read(talkToBase);
    __is->read(talkToCommonHead);
}

void
IceProxy::RoboCompCamera::Camera::getYUVImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCamera__Camera__getYUVImage_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCamera::Camera* __del = dynamic_cast< ::IceDelegate::RoboCompCamera::Camera*>(__delBase.get());
            __del->getYUVImage(cam, roi, hState, bState, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapperRelaxed(__delBase, __ex, 0, __cnt);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCamera::Camera::getYImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCamera__Camera__getYImage_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCamera::Camera* __del = dynamic_cast< ::IceDelegate::RoboCompCamera::Camera*>(__delBase.get());
            __del->getYImage(cam, roi, hState, bState, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapperRelaxed(__delBase, __ex, 0, __cnt);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCamera::Camera::getYLogPolarImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCamera__Camera__getYLogPolarImage_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCamera::Camera* __del = dynamic_cast< ::IceDelegate::RoboCompCamera::Camera*>(__delBase.get());
            __del->getYLogPolarImage(cam, roi, hState, bState, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapperRelaxed(__delBase, __ex, 0, __cnt);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCamera::Camera::getYImageCR(::Ice::Int cam, ::Ice::Int div, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCamera__Camera__getYImageCR_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCamera::Camera* __del = dynamic_cast< ::IceDelegate::RoboCompCamera::Camera*>(__delBase.get());
            __del->getYImageCR(cam, div, roi, hState, bState, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapperRelaxed(__delBase, __ex, 0, __cnt);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCamera::Camera::getRGBPackedImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCamera__Camera__getRGBPackedImage_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCamera::Camera* __del = dynamic_cast< ::IceDelegate::RoboCompCamera::Camera*>(__delBase.get());
            __del->getRGBPackedImage(cam, roi, hState, bState, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapperRelaxed(__delBase, __ex, 0, __cnt);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCamera::Camera::getYRGBImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCamera__Camera__getYRGBImage_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCamera::Camera* __del = dynamic_cast< ::IceDelegate::RoboCompCamera::Camera*>(__delBase.get());
            __del->getYRGBImage(cam, roi, hState, bState, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapperRelaxed(__delBase, __ex, 0, __cnt);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

::RoboCompCamera::TCamParams
IceProxy::RoboCompCamera::Camera::getCamParams(const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __checkTwowayOnly(__RoboCompCamera__Camera__getCamParams_name);
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCamera::Camera* __del = dynamic_cast< ::IceDelegate::RoboCompCamera::Camera*>(__delBase.get());
            return __del->getCamParams(__ctx);
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapper(__delBase, __ex, 0);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

void
IceProxy::RoboCompCamera::Camera::setInnerImage(const ::RoboCompCamera::imgType& roi, const ::Ice::Context* __ctx)
{
    int __cnt = 0;
    while(true)
    {
        ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
        try
        {
#if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug
            IceUtil::DummyBCC dummy;
#endif
            __delBase = __getDelegate(false);
            ::IceDelegate::RoboCompCamera::Camera* __del = dynamic_cast< ::IceDelegate::RoboCompCamera::Camera*>(__delBase.get());
            __del->setInnerImage(roi, __ctx);
            return;
        }
        catch(const ::IceInternal::LocalExceptionWrapper& __ex)
        {
            __handleExceptionWrapperRelaxed(__delBase, __ex, 0, __cnt);
        }
        catch(const ::Ice::LocalException& __ex)
        {
            __handleException(__delBase, __ex, 0, __cnt);
        }
    }
}

const ::std::string&
IceProxy::RoboCompCamera::Camera::ice_staticId()
{
    return ::RoboCompCamera::Camera::ice_staticId();
}

::IceInternal::Handle< ::IceDelegateM::Ice::Object>
IceProxy::RoboCompCamera::Camera::__createDelegateM()
{
    return ::IceInternal::Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::RoboCompCamera::Camera);
}

::IceInternal::Handle< ::IceDelegateD::Ice::Object>
IceProxy::RoboCompCamera::Camera::__createDelegateD()
{
    return ::IceInternal::Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD::RoboCompCamera::Camera);
}

::IceProxy::Ice::Object*
IceProxy::RoboCompCamera::Camera::__newInstance() const
{
    return new Camera;
}

void
IceDelegateM::RoboCompCamera::Camera::getYUVImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCamera__Camera__getYUVImage_name, ::Ice::Idempotent, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(cam);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompCamera::HardwareFailedException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*> ___roi;
        __is->read(___roi);
        ::std::vector< ::Ice::Byte>(___roi.first, ___roi.second).swap(roi);
        hState.__read(__is);
        bState.__read(__is);
        __is->endReadEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCamera::Camera::getYImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCamera__Camera__getYImage_name, ::Ice::Idempotent, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(cam);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompCamera::MovingImageException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*> ___roi;
        __is->read(___roi);
        ::std::vector< ::Ice::Byte>(___roi.first, ___roi.second).swap(roi);
        hState.__read(__is);
        bState.__read(__is);
        __is->endReadEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCamera::Camera::getYLogPolarImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCamera__Camera__getYLogPolarImage_name, ::Ice::Idempotent, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(cam);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompCamera::MovingImageException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*> ___roi;
        __is->read(___roi);
        ::std::vector< ::Ice::Byte>(___roi.first, ___roi.second).swap(roi);
        hState.__read(__is);
        bState.__read(__is);
        __is->endReadEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCamera::Camera::getYImageCR(::Ice::Int cam, ::Ice::Int div, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCamera__Camera__getYImageCR_name, ::Ice::Idempotent, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(cam);
        __os->write(div);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompCamera::MovingImageException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*> ___roi;
        __is->read(___roi);
        ::std::vector< ::Ice::Byte>(___roi.first, ___roi.second).swap(roi);
        hState.__read(__is);
        bState.__read(__is);
        __is->endReadEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCamera::Camera::getRGBPackedImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCamera__Camera__getRGBPackedImage_name, ::Ice::Idempotent, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(cam);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompCamera::MovingImageException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*> ___roi;
        __is->read(___roi);
        ::std::vector< ::Ice::Byte>(___roi.first, ___roi.second).swap(roi);
        hState.__read(__is);
        bState.__read(__is);
        __is->endReadEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCamera::Camera::getYRGBImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCamera__Camera__getYRGBImage_name, ::Ice::Idempotent, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        __os->write(cam);
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::RoboCompCamera::MovingImageException&)
            {
                throw;
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*> ___roi;
        __is->read(___roi);
        ::std::vector< ::Ice::Byte>(___roi.first, ___roi.second).swap(roi);
        hState.__read(__is);
        bState.__read(__is);
        __is->endReadEncaps();
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

::RoboCompCamera::TCamParams
IceDelegateM::RoboCompCamera::Camera::getCamParams(const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCamera__Camera__getCamParams_name, ::Ice::Normal, __context);
    bool __ok = __og.invoke();
    ::RoboCompCamera::TCamParams __ret;
    try
    {
        if(!__ok)
        {
            try
            {
                __og.throwUserException();
            }
            catch(const ::Ice::UserException& __ex)
            {
                ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                throw __uue;
            }
        }
        ::IceInternal::BasicStream* __is = __og.is();
        __is->startReadEncaps();
        __ret.__read(__is);
        __is->endReadEncaps();
        return __ret;
    }
    catch(const ::Ice::LocalException& __ex)
    {
        throw ::IceInternal::LocalExceptionWrapper(__ex, false);
    }
}

void
IceDelegateM::RoboCompCamera::Camera::setInnerImage(const ::RoboCompCamera::imgType& roi, const ::Ice::Context* __context)
{
    ::IceInternal::Outgoing __og(__handler.get(), __RoboCompCamera__Camera__setInnerImage_name, ::Ice::Idempotent, __context);
    try
    {
        ::IceInternal::BasicStream* __os = __og.os();
        if(roi.size() == 0)
        {
            __os->writeSize(0);
        }
        else
        {
            __os->write(&roi[0], &roi[0] + roi.size());
        }
    }
    catch(const ::Ice::LocalException& __ex)
    {
        __og.abort(__ex);
    }
    bool __ok = __og.invoke();
    if(!__og.is()->b.empty())
    {
        try
        {
            if(!__ok)
            {
                try
                {
                    __og.throwUserException();
                }
                catch(const ::Ice::UserException& __ex)
                {
                    ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
                    throw __uue;
                }
            }
            __og.is()->skipEmptyEncaps();
        }
        catch(const ::Ice::LocalException& __ex)
        {
            throw ::IceInternal::LocalExceptionWrapper(__ex, false);
        }
    }
}

void
IceDelegateD::RoboCompCamera::Camera::getYUVImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_cam(cam),
            _m_roi(roi),
            _m_hState(hState),
            _m_bState(bState)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCamera::Camera* servant = dynamic_cast< ::RoboCompCamera::Camera*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->getYUVImage(_m_cam, _m_roi, _m_hState, _m_bState, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Int _m_cam;
        ::RoboCompCamera::imgType& _m_roi;
        ::RoboCompCommonHead::THeadState& _m_hState;
        ::RoboCompDifferentialRobot::TBaseState& _m_bState;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCamera__Camera__getYUVImage_name, ::Ice::Idempotent, __context);
    try
    {
        _DirectI __direct(cam, roi, hState, bState, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompCamera::HardwareFailedException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCamera::Camera::getYImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_cam(cam),
            _m_roi(roi),
            _m_hState(hState),
            _m_bState(bState)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCamera::Camera* servant = dynamic_cast< ::RoboCompCamera::Camera*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->getYImage(_m_cam, _m_roi, _m_hState, _m_bState, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Int _m_cam;
        ::RoboCompCamera::imgType& _m_roi;
        ::RoboCompCommonHead::THeadState& _m_hState;
        ::RoboCompDifferentialRobot::TBaseState& _m_bState;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCamera__Camera__getYImage_name, ::Ice::Idempotent, __context);
    try
    {
        _DirectI __direct(cam, roi, hState, bState, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompCamera::MovingImageException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCamera::Camera::getYLogPolarImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_cam(cam),
            _m_roi(roi),
            _m_hState(hState),
            _m_bState(bState)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCamera::Camera* servant = dynamic_cast< ::RoboCompCamera::Camera*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->getYLogPolarImage(_m_cam, _m_roi, _m_hState, _m_bState, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Int _m_cam;
        ::RoboCompCamera::imgType& _m_roi;
        ::RoboCompCommonHead::THeadState& _m_hState;
        ::RoboCompDifferentialRobot::TBaseState& _m_bState;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCamera__Camera__getYLogPolarImage_name, ::Ice::Idempotent, __context);
    try
    {
        _DirectI __direct(cam, roi, hState, bState, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompCamera::MovingImageException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCamera::Camera::getYImageCR(::Ice::Int cam, ::Ice::Int div, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Int cam, ::Ice::Int div, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_cam(cam),
            _m_div(div),
            _m_roi(roi),
            _m_hState(hState),
            _m_bState(bState)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCamera::Camera* servant = dynamic_cast< ::RoboCompCamera::Camera*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->getYImageCR(_m_cam, _m_div, _m_roi, _m_hState, _m_bState, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Int _m_cam;
        ::Ice::Int _m_div;
        ::RoboCompCamera::imgType& _m_roi;
        ::RoboCompCommonHead::THeadState& _m_hState;
        ::RoboCompDifferentialRobot::TBaseState& _m_bState;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCamera__Camera__getYImageCR_name, ::Ice::Idempotent, __context);
    try
    {
        _DirectI __direct(cam, div, roi, hState, bState, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompCamera::MovingImageException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCamera::Camera::getRGBPackedImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_cam(cam),
            _m_roi(roi),
            _m_hState(hState),
            _m_bState(bState)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCamera::Camera* servant = dynamic_cast< ::RoboCompCamera::Camera*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->getRGBPackedImage(_m_cam, _m_roi, _m_hState, _m_bState, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Int _m_cam;
        ::RoboCompCamera::imgType& _m_roi;
        ::RoboCompCommonHead::THeadState& _m_hState;
        ::RoboCompDifferentialRobot::TBaseState& _m_bState;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCamera__Camera__getRGBPackedImage_name, ::Ice::Idempotent, __context);
    try
    {
        _DirectI __direct(cam, roi, hState, bState, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompCamera::MovingImageException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

void
IceDelegateD::RoboCompCamera::Camera::getYRGBImage(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::Ice::Int cam, ::RoboCompCamera::imgType& roi, ::RoboCompCommonHead::THeadState& hState, ::RoboCompDifferentialRobot::TBaseState& bState, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_cam(cam),
            _m_roi(roi),
            _m_hState(hState),
            _m_bState(bState)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCamera::Camera* servant = dynamic_cast< ::RoboCompCamera::Camera*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            try
            {
                servant->getYRGBImage(_m_cam, _m_roi, _m_hState, _m_bState, _current);
                return ::Ice::DispatchOK;
            }
            catch(const ::Ice::UserException& __ex)
            {
                setUserException(__ex);
                return ::Ice::DispatchUserException;
            }
        }
        
    private:
        
        ::Ice::Int _m_cam;
        ::RoboCompCamera::imgType& _m_roi;
        ::RoboCompCommonHead::THeadState& _m_hState;
        ::RoboCompDifferentialRobot::TBaseState& _m_bState;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCamera__Camera__getYRGBImage_name, ::Ice::Idempotent, __context);
    try
    {
        _DirectI __direct(cam, roi, hState, bState, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::RoboCompCamera::MovingImageException&)
    {
        throw;
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

::RoboCompCamera::TCamParams
IceDelegateD::RoboCompCamera::Camera::getCamParams(const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(::RoboCompCamera::TCamParams& __result, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _result(__result)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCamera::Camera* servant = dynamic_cast< ::RoboCompCamera::Camera*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            _result = servant->getCamParams(_current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
        ::RoboCompCamera::TCamParams& _result;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCamera__Camera__getCamParams_name, ::Ice::Normal, __context);
    ::RoboCompCamera::TCamParams __result;
    try
    {
        _DirectI __direct(__result, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
    return __result;
}

void
IceDelegateD::RoboCompCamera::Camera::setInnerImage(const ::RoboCompCamera::imgType& roi, const ::Ice::Context* __context)
{
    class _DirectI : public ::IceInternal::Direct
    {
    public:

        _DirectI(const ::RoboCompCamera::imgType& roi, const ::Ice::Current& __current) : 
            ::IceInternal::Direct(__current),
            _m_roi(roi)
        {
        }
        
        virtual ::Ice::DispatchStatus
        run(::Ice::Object* object)
        {
            ::RoboCompCamera::Camera* servant = dynamic_cast< ::RoboCompCamera::Camera*>(object);
            if(!servant)
            {
                throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
            }
            servant->setInnerImage(_m_roi, _current);
            return ::Ice::DispatchOK;
        }
        
    private:
        
        const ::RoboCompCamera::imgType& _m_roi;
    };
    
    ::Ice::Current __current;
    __initCurrent(__current, __RoboCompCamera__Camera__setInnerImage_name, ::Ice::Idempotent, __context);
    try
    {
        _DirectI __direct(roi, __current);
        try
        {
            __direct.servant()->__collocDispatch(__direct);
        }
        catch(...)
        {
            __direct.destroy();
            throw;
        }
        __direct.destroy();
    }
    catch(const ::Ice::SystemException&)
    {
        throw;
    }
    catch(const ::IceInternal::LocalExceptionWrapper&)
    {
        throw;
    }
    catch(const ::std::exception& __ex)
    {
        ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
    }
    catch(...)
    {
        throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
    }
}

::Ice::ObjectPtr
RoboCompCamera::Camera::ice_clone() const
{
    throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);
    return 0; // to avoid a warning with some compilers
}

static const ::std::string __RoboCompCamera__Camera_ids[2] =
{
    "::Ice::Object",
    "::RoboCompCamera::Camera"
};

bool
RoboCompCamera::Camera::ice_isA(const ::std::string& _s, const ::Ice::Current&) const
{
    return ::std::binary_search(__RoboCompCamera__Camera_ids, __RoboCompCamera__Camera_ids + 2, _s);
}

::std::vector< ::std::string>
RoboCompCamera::Camera::ice_ids(const ::Ice::Current&) const
{
    return ::std::vector< ::std::string>(&__RoboCompCamera__Camera_ids[0], &__RoboCompCamera__Camera_ids[2]);
}

const ::std::string&
RoboCompCamera::Camera::ice_id(const ::Ice::Current&) const
{
    return __RoboCompCamera__Camera_ids[1];
}

const ::std::string&
RoboCompCamera::Camera::ice_staticId()
{
    return __RoboCompCamera__Camera_ids[1];
}

::Ice::DispatchStatus
RoboCompCamera::Camera::___getYUVImage(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Idempotent, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Int cam;
    __is->read(cam);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::RoboCompCamera::imgType roi;
    ::RoboCompCommonHead::THeadState hState;
    ::RoboCompDifferentialRobot::TBaseState bState;
    try
    {
        getYUVImage(cam, roi, hState, bState, __current);
        if(roi.size() == 0)
        {
            __os->writeSize(0);
        }
        else
        {
            __os->write(&roi[0], &roi[0] + roi.size());
        }
        hState.__write(__os);
        bState.__write(__os);
    }
    catch(const ::RoboCompCamera::HardwareFailedException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCamera::Camera::___getYImage(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Idempotent, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Int cam;
    __is->read(cam);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::RoboCompCamera::imgType roi;
    ::RoboCompCommonHead::THeadState hState;
    ::RoboCompDifferentialRobot::TBaseState bState;
    try
    {
        getYImage(cam, roi, hState, bState, __current);
        if(roi.size() == 0)
        {
            __os->writeSize(0);
        }
        else
        {
            __os->write(&roi[0], &roi[0] + roi.size());
        }
        hState.__write(__os);
        bState.__write(__os);
    }
    catch(const ::RoboCompCamera::MovingImageException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCamera::Camera::___getYLogPolarImage(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Idempotent, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Int cam;
    __is->read(cam);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::RoboCompCamera::imgType roi;
    ::RoboCompCommonHead::THeadState hState;
    ::RoboCompDifferentialRobot::TBaseState bState;
    try
    {
        getYLogPolarImage(cam, roi, hState, bState, __current);
        if(roi.size() == 0)
        {
            __os->writeSize(0);
        }
        else
        {
            __os->write(&roi[0], &roi[0] + roi.size());
        }
        hState.__write(__os);
        bState.__write(__os);
    }
    catch(const ::RoboCompCamera::MovingImageException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCamera::Camera::___getYImageCR(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Idempotent, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Int cam;
    ::Ice::Int div;
    __is->read(cam);
    __is->read(div);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::RoboCompCamera::imgType roi;
    ::RoboCompCommonHead::THeadState hState;
    ::RoboCompDifferentialRobot::TBaseState bState;
    try
    {
        getYImageCR(cam, div, roi, hState, bState, __current);
        if(roi.size() == 0)
        {
            __os->writeSize(0);
        }
        else
        {
            __os->write(&roi[0], &roi[0] + roi.size());
        }
        hState.__write(__os);
        bState.__write(__os);
    }
    catch(const ::RoboCompCamera::MovingImageException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCamera::Camera::___getRGBPackedImage(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Idempotent, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Int cam;
    __is->read(cam);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::RoboCompCamera::imgType roi;
    ::RoboCompCommonHead::THeadState hState;
    ::RoboCompDifferentialRobot::TBaseState bState;
    try
    {
        getRGBPackedImage(cam, roi, hState, bState, __current);
        if(roi.size() == 0)
        {
            __os->writeSize(0);
        }
        else
        {
            __os->write(&roi[0], &roi[0] + roi.size());
        }
        hState.__write(__os);
        bState.__write(__os);
    }
    catch(const ::RoboCompCamera::MovingImageException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCamera::Camera::___getYRGBImage(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Idempotent, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::Ice::Int cam;
    __is->read(cam);
    __is->endReadEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::RoboCompCamera::imgType roi;
    ::RoboCompCommonHead::THeadState hState;
    ::RoboCompDifferentialRobot::TBaseState bState;
    try
    {
        getYRGBImage(cam, roi, hState, bState, __current);
        if(roi.size() == 0)
        {
            __os->writeSize(0);
        }
        else
        {
            __os->write(&roi[0], &roi[0] + roi.size());
        }
        hState.__write(__os);
        bState.__write(__os);
    }
    catch(const ::RoboCompCamera::MovingImageException& __ex)
    {
        __os->write(__ex);
        return ::Ice::DispatchUserException;
    }
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCamera::Camera::___getCamParams(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    __inS.is()->skipEmptyEncaps();
    ::IceInternal::BasicStream* __os = __inS.os();
    ::RoboCompCamera::TCamParams __ret = getCamParams(__current);
    __ret.__write(__os);
    return ::Ice::DispatchOK;
}

::Ice::DispatchStatus
RoboCompCamera::Camera::___setInnerImage(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Idempotent, __current.mode);
    ::IceInternal::BasicStream* __is = __inS.is();
    __is->startReadEncaps();
    ::RoboCompCamera::imgType roi;
    ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*> ___roi;
    __is->read(___roi);
    ::std::vector< ::Ice::Byte>(___roi.first, ___roi.second).swap(roi);
    __is->endReadEncaps();
    setInnerImage(roi, __current);
    return ::Ice::DispatchOK;
}

static ::std::string __RoboCompCamera__Camera_all[] =
{
    "getCamParams",
    "getRGBPackedImage",
    "getYImage",
    "getYImageCR",
    "getYLogPolarImage",
    "getYRGBImage",
    "getYUVImage",
    "ice_id",
    "ice_ids",
    "ice_isA",
    "ice_ping",
    "setInnerImage"
};

::Ice::DispatchStatus
RoboCompCamera::Camera::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)
{
    ::std::pair< ::std::string*, ::std::string*> r = ::std::equal_range(__RoboCompCamera__Camera_all, __RoboCompCamera__Camera_all + 12, current.operation);
    if(r.first == r.second)
    {
        throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
    }

    switch(r.first - __RoboCompCamera__Camera_all)
    {
        case 0:
        {
            return ___getCamParams(in, current);
        }
        case 1:
        {
            return ___getRGBPackedImage(in, current);
        }
        case 2:
        {
            return ___getYImage(in, current);
        }
        case 3:
        {
            return ___getYImageCR(in, current);
        }
        case 4:
        {
            return ___getYLogPolarImage(in, current);
        }
        case 5:
        {
            return ___getYRGBImage(in, current);
        }
        case 6:
        {
            return ___getYUVImage(in, current);
        }
        case 7:
        {
            return ___ice_id(in, current);
        }
        case 8:
        {
            return ___ice_ids(in, current);
        }
        case 9:
        {
            return ___ice_isA(in, current);
        }
        case 10:
        {
            return ___ice_ping(in, current);
        }
        case 11:
        {
            return ___setInnerImage(in, current);
        }
    }

    assert(false);
    throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
}

void
RoboCompCamera::Camera::__write(::IceInternal::BasicStream* __os) const
{
    __os->writeTypeId(ice_staticId());
    __os->startWriteSlice();
    __os->endWriteSlice();
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    Object::__write(__os);
#else
    ::Ice::Object::__write(__os);
#endif
}

void
RoboCompCamera::Camera::__read(::IceInternal::BasicStream* __is, bool __rid)
{
    if(__rid)
    {
        ::std::string myId;
        __is->readTypeId(myId);
    }
    __is->startReadSlice();
    __is->endReadSlice();
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    Object::__read(__is, true);
#else
    ::Ice::Object::__read(__is, true);
#endif
}

void
RoboCompCamera::Camera::__write(const ::Ice::OutputStreamPtr&) const
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "type RoboCompCamera::Camera was not generated with stream support";
    throw ex;
}

void
RoboCompCamera::Camera::__read(const ::Ice::InputStreamPtr&, bool)
{
    Ice::MarshalException ex(__FILE__, __LINE__);
    ex.reason = "type RoboCompCamera::Camera was not generated with stream support";
    throw ex;
}

void 
RoboCompCamera::__patch__CameraPtr(void* __addr, ::Ice::ObjectPtr& v)
{
    ::RoboCompCamera::CameraPtr* p = static_cast< ::RoboCompCamera::CameraPtr*>(__addr);
    assert(p);
    *p = ::RoboCompCamera::CameraPtr::dynamicCast(v);
    if(v && !*p)
    {
        IceInternal::Ex::throwUOE(::RoboCompCamera::Camera::ice_staticId(), v->ice_id());
    }
}

bool
RoboCompCamera::operator==(const ::RoboCompCamera::Camera& l, const ::RoboCompCamera::Camera& r)
{
    return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);
}

bool
RoboCompCamera::operator<(const ::RoboCompCamera::Camera& l, const ::RoboCompCamera::Camera& r)
{
    return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);
}
